import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/css/base.css'
import { Button, Form, Select, Input, Layout, Breadcrumb, Menu, Table, Switch, Pagination, ConfigProvider, Drawer, Row, Col, Tag, Modal, Tree, Tooltip } from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
// axios不能使用use挂载，必须挂载到实例的原型对象上
import axios from 'axios'
const app = createApp(App)
    // 导出前配置基准地址
axios.defaults.baseURL = 'http://106.52.84.103:8888/api/private/v1/'
    // 配置响应拦截器，过滤数据，直接返回需要的data
axios.interceptors.response.use(res => res.data)
    // 配置请求拦截器携带token请求
axios.interceptors.request.use(config => {
    // headers上设置请求头
    config.headers.Authorization = window.sessionStorage.token
    return config
})
app.config.globalProperties.$http = axios

app.use(store)
    .use(router)
    .use(Input)
    .use(Form)
    .use(Button)
    .use(Select)
    .use(Layout)
    .use(Breadcrumb)
    .use(Menu)
    .use(Table)
    .use(Switch)
    .use(Pagination)
    .use(ConfigProvider)
    .use(Drawer)
    .use(Row)
    .use(Col)
    .use(Tag)
    .use(Modal)
    .use(Tree)
    .use(Tooltip)
    .mount('#app')